package cn.itheima.feign;

import cn.itcast.result.Result;
import cn.itheima.shoppingcart.dto.ShoppingCartDTO;
import cn.itheima.shoppingcart.pojo.ShoppingCart;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name="sky-shopping-cart",contextId = "shopping-cart")
public interface ShoppingCartClient {

    @PostMapping("/user/shoppingCart/add")
    Result<String> add(@RequestBody ShoppingCartDTO shoppingCartDTO);


    @DeleteMapping("/user/shoppingCart/clean/{userId}")
    @ApiOperation("清空购物车商品")
    Result<String> clean(@PathVariable long userId);

    @GetMapping("/user/shoppingCart/list")
    @ApiOperation("查看购物车")
    Result<List<ShoppingCart>> list(long userId);
}
